<?php
class VariablesSites extends AppModel
{
  var $name = 'VariablesSites';
  var $useTable = "variables_sites";
  var $id = "vs_v_id";
  var $primaryKey = "vs_v_id";

  function get_variables_site($site)
  {
		$cond = "vs_s_id=$site";
		$rows = $this->findAll($cond, "vs_v_id, vs_s_id, vs_use_default", "vs_v_id", null, 1, null);
		return $rows;
	}
	
	function serialize($values, $key)
	{
    $rows = array();
    foreach ($values as $id => $valArray)
    {
      $rows[$valArray[$this->name][$key]] = $valArray[$this->name];
    }
    return $rows;
  }

	function getFieldValue($field, $key, $key_value)
	{
		$rows = $this->field($field, array("$key" => "$key_value"));
		return $rows;
  }

  function getFieldsValue($whereArray, $fields)
  {
		$rows = $this->find($whereArray, $fields, null, null);
		return $rows;
  }

  function setPrimaryKey ($key)
  {
    $this->primaryKey = $key;
  }

}
?>
